package com.jingbo.servlet;

import com.jingbo.DAO.Record.pecordimpl;
import com.jingbo.entity.Profile;
import com.jingbo.service.record.recordimpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.jingbo.servlet
 * @Description:
 * @Date 2022/5/28 12:32
 */
@WebServlet("/update")
public class updateOne extends BeanServlet {
    public String  UpdateOne(HttpServletRequest request ,HttpServletResponse response){
        String parameter = request.getParameter("id");
        String name = request.getParameter("name");
        String birthday = request.getParameter("birthday");
        String gender = request.getParameter("gender");
        String career = request.getParameter("career");
        String address = request.getParameter("address");
        String mobile = request.getParameter("mobile");
        String picture = request.getParameter("picture");

        recordimpl recordimpl = new recordimpl(new pecordimpl());
        boolean b = recordimpl.updateOne(new Profile(Integer.parseInt(parameter),name, birthday, gender, career, address, mobile, picture), Integer.parseInt(parameter));
        if (b){
            return "forward:selectAll?method=selectAll";
        }else{
            return "forward:/update.jsp";
        }

    }
}
